package com.study.string;

import java.util.Scanner;

public class StringEqualsDemo5 {
    public static void main(String[] args) {
        // 1.正确录入姓名和密码
        String okName = "root";
        String okPassword = "123456";

        // 2.请正确输入姓名和密码
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用户名：");
        String name = sc.next();
        System.out.println("请输入密码：");
        String password = sc.next();

        //3.判断用户的登录名和密码是否正确
        if (okName.equals(name) && okPassword.equals(password)){
            System.out.println("登录成功！");
        }else {
            System.out.println("用户名或密码错误！");
        }

        // 4.忽略大小写比较内容的API:一般用于比较验证码这样的业务逻辑
        String sysCode = "23AdFh";
        String code1 = "23aDfH";
        System.out.println(sysCode.equals(code1));
        System.out.println(sysCode.equalsIgnoreCase(code1));



    }
}
